<template>
  <div class="price sortPage">
    <pricebar @showbar="tardeNumset" :tardeNum="tardeNum"></pricebar>
    <van-sticky v-show="tardeNum==1" :offset-top="46">
      <coll-dom></coll-dom>
    </van-sticky>
    <price-list v-if="tardeNum==1"></price-list>
    <priceselfList v-if="tardeNum==0"></priceselfList>
  </div>
</template>

<script type="text/ecmascript-6">
import collDom from "../../components/price/collapse";
import priceList from "../../components/price/priceList";
import priceselfList from "../../components/price/priceselfList";
import pricebar from "../../components/nav/pricebar.vue";
export default {
  components: {
    collDom,
    priceList,
    pricebar,
    priceselfList
  },
  data() {
    return {
      tardeNum: 0
    };
  },
  computed: {
    pricepartObj() {
      return this.$store.state.nocaches.pricepartObj;
    }
  },
  methods: {
    tardeNumset(i) {
      this.tardeNum = i;
      if (i == 1) {
        document.getElementsByClassName(
          "van-sticky"
        )[0].parentNode.style.height = "46px";
        document.getElementsByClassName(
          "van-sticky"
        )[1].parentNode.style.height = "46px";
      }
    },
    judge() {
      let channel = this.$store.state.nocaches.pricepartObj.channel;
      let islogin = this.$store.state.islogin;
      if (islogin) {
        let obj = this.$store.state.loginInforXl;
        if (channel == "tcl") {
          this.myprice = obj.tcl_myprice;
        } else if (channel == "dc") {
          this.myprice = obj.dc_myprice;
        } else {
          this.myprice = obj.dlg_myprice;
        }
        if (this.myprice.length > 0) {
          this.tardeNum = 0;
        } else {
          this.tardeNum = 1;
        }
      } else {
        this.tardeNum = 1;
      }
    }
  },
  created() {
    this.judge();
  }
};
</script>
<style scoped lang="less">
.price {
  width: 100%;
  min-height: 100%;
  background: #ffffff;
}

.van-dropdown-menu {
  height: 0.88rem;
}
</style>
